package com.lzlearn.config;

import org.springframework.aop.AfterReturningAdvice;
import org.springframework.aop.MethodBeforeAdvice;
import org.springframework.stereotype.Component;

import java.lang.reflect.Method;

public class TranscationAdvice implements MethodBeforeAdvice , AfterReturningAdvice {
    @Override
    public void afterReturning(Object o, Method method, Object[] objects, Object o1) throws Throwable {
       //后置处理器
        System.out.println("提供后置操作,如提交事务");
    }

    @Override
    public void before(Method method, Object[] objects, Object o) throws Throwable {
        //前置处理器
        System.out.println("提供前置操作,如开启事务");
    }
}
